package findLucky;

public class Solution {
    public int findLucky(int[] arr) {
        int[] times = new int[501]; // 出现的次数
        for (int i = 0; i < arr.length; i++) {
            times[arr[i]]++;
        }
        for (int i = 500; i >=1 ; i--) {
            if(times[i] == i){
                return i;
            }
        }
        return -1;
    }
}
